<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>聊天室申请管理列表</title>
    <link rel="stylesheet" type="text/css" th:href="@{/js/layui/css/layui.css}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/style.css/}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/my.css/}" media="all">

</head>
<body class="body">
<!--<script type="text/html" id="topOperate">-->
    <!--<div class="my-btn-box layui-form">-->
      <!--<span class="fl">-->
    <!--<button class="layui-btn layui-btn-sm" lay-event="toSave"><i class="layui-icon layui-icon-add-1"></i>添加</button>-->
      <!--</span>-->
    <!--</div>-->
<!--</script>-->
<div class="my-btn-box layui-form">
</div>
<!-- 表格 -->
<div id="dateTable" lay-filter="event"></div>
<div class="height50"></div>
<script th:src="@{/js/layui/layui.js}"></script>
<script th:src="@{/js/fyn/index.js}"></script>
<script th:src="@{/js/fyn/my.js}"></script>
<script type="text/javascript" th:src="@{/js/vip/vip_comm.js}"></script>
<script type="text/javascript" th:src="@{/js/vip/vip_table.js}"></script>
<script type="text/javascript" th:inline="javascript">

    // layui方法
    layui.use(['table', 'form', 'laypage', 'layer', 'vip_table','laydate'], function () {
        // 操作对象
        var form = layui.form
            , table = layui.table
            , layer = layui.layer
            , $ = layui.jquery;

        // 表格渲染
        var tableIns = table.render({
            elem: '#dateTable'                  //指定原始表格元素选择器（推荐id选择器）
            , height: "full"    //容器高度
            // , skin: 'line'
            , even: 'true'
            , cols: [[                  //标题栏
                 {
                    field: 'chatroomId', title: '聊天室ID',minWidth: 100, align: 'center'
                }
                , {
                    field: 'chatroomName', title: '聊天室名称', minWidth: 100, align: 'center'
                }
                , {
                    field: 'userId', title: '用户ID', minWidth: 100, align: 'center'
                }
                , {
                    field: 'nick', title: '用户昵称', minWidth: 100, align: 'center'
                }
                , {
                    field: 'mobile', title: '手机号', minWidth: 100, align: 'center'
                }
                , {
                    field: 'realName', title: '真实姓名', minWidth: 100, align: 'center'
                }
                , {
                    field: 'applyStatus', title: '审核状态', minWidth: 100, align: 'center',templet: function (d) {
                        if (d.applyStatus == 0) {
                            return "待审核";
                        }
                        if (d.applyStatus == 1) {
                            return "审核通过";
                        }
                        if (d.applyStatus == 2) {
                            return "拒绝-仍可申请";
                        }
                        if (d.applyStatus == 3) {
                            return "拒绝-不可申请";
                        }
                    }
                }
                , {
                    field: 'createTime',
                    align: 'center',
                    title: '申请时间',
                    sort: true,
                    minWidth: 150,
                    templet: function (d) {
                        return new Date(d.createTime).Format("yyyy-MM-dd hh:mm:ss");
                    }
                }
                , {title: '操作', align: 'center',minWidth: 250, toolbar: '#barOption'} //这里的toolbar值是模板元素的选择器
            ]]
            , id: 'dataCheck'
            , url: [[${basePath}]] + '/message/chatroom/userApplyList'
            , method: 'get'
            , page: true
            , limits: [10, 30, 60, 90, 150, 300]
            , toolbar: '#topOperate'
            , limit: 10 //默认采用0
            , loading: true
            // , where: getJson()
            , done: function (res, curr, count) {
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                $("td[data-field='content']").each(function () {
                    $(this).find(".layui-table-cell").removeClass('layui-table-cell');
                });


            }
        });

        table.on('tool(event)', function (obj) {
            var data = obj.data;
            if (obj.event === 'apply') {
                layer.open({
                    type: 2,
                    title: '审核',
                    shadeClose: true,
                    shade: 0.2,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['650px', '550px'],
                    content: [[${basePath}]] + '/message/chatroom/applying?userId='+data.userId+"&chatroomId="+data.chatroomId,
                });
            }

        });

        function getJson() {
            return {
                where: {
                    sendName: $("input[name='name']").val()
                }
            };
        }
        $("#search").click(function () {
            tableIns.reload({
                where: {
                    sendName: $("input[name='name']").val()
                },
                page: {
                    curr: 1
                }
            });
        })
    });
</script>
<!-- 表格操作按钮集 -->
<script type="text/html" id="barOption">
    <a class="layui-btn layui-btn-xs" lay-event="apply"><i class="layui-icon layui-icon-add"></i>审核</a>
</script>
</body>
</html>